package com.foton.lotterydomain.activity.service.stateflow;

import com.foton.lotterycommon.common.Constants;
import com.foton.lotterydomain.activity.service.stateflow.event.*;
import jdk.nashorn.internal.ir.CallNode;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @Author RenPu
 * @Date 2023/12/1 17:18
 * @Version 1.0
 * @Description: 活动状态 -流程规则的定义以及策略的封装
 **/
public class StateConfig {

    protected Map<Enum<Constants.ActivityState>, AbstractState> stateMap = new ConcurrentHashMap<>();

    @Resource
    private ArraignmentState arraignmentState;
    @Resource
    private CloseState closeState;
    @Resource
    private DoingState doingState;
    @Resource
    private EditingState editingState;
    @Resource
    private OpenState openState;
    @Resource
    private PassState passState;
    @Resource
    private RefuseState refuseState;


    @PostConstruct
    public void init() {
        stateMap.put(Constants.ActivityState.ARRAIGNMENT, arraignmentState);
        stateMap.put(Constants.ActivityState.PASS, passState);
        stateMap.put(Constants.ActivityState.REFUSE, refuseState);
        stateMap.put(Constants.ActivityState.OPEN, openState);
        stateMap.put(Constants.ActivityState.CLOSE, closeState);
        stateMap.put(Constants.ActivityState.DOING, doingState);
        stateMap.put(Constants.ActivityState.EDIT, editingState);
    }


}
